Back to Transposition

Rail Fence Cipher

What is a Rail Fence Cipher?

Rail Fence cipher is a simple transposition cipher that writes the message in a normal pattern on a number of "rails" (horizontal lines), then reads off each rail to create the ciphertext. Despite its simplicity, it can effectively scramble text in a way that's not immediately obvious to read, though it's not considered cryptographically secure by modern standards.

Key Components:

   1. Number of rails (key)
   2. Message text
   3. Normal pattern
   4. Reading direction

Key Rules:

   1. Write text down
   2. Write text vertical
   3. Read text horizontally
   4. Spaces are usually removed

Example with 3 rails:

Message: "CIPHERBOY"

Read text horizontally
      ⭢      ⭢      ⭢
⭣      C      H      B
⭣      I        E      O
⭣      P      R      Y
Write the message down
Result: "CIPHERBOY " → "CHBIEOPRY"

Video for explanation